package de.zainodis.commons;

import android.util.Log;

/**
 * Wraps calls to the android {@link Log}, so that we have more control over the
 * logging mechanism and better means of controlling and later filtering log
 * tags.
 * 
 * @author fzarrai
 * 
 */
public class LogCat {

   /**
    * The application wide standard Tag. This only constitutes the first part of
    * the complete tag that's used for logging. The second part is passed to the
    * actual log calls.
    */
   private static final String TAG = "de.zainodis.";

   private LogCat() {
	 // No need to instantiate this one
   }

   public static void e(String classTag, String message, Throwable e) {
	 Log.e(createLoggableTag(classTag), message, e);
   }

   public static void e(String classTag, String message) {
	 Log.e(createLoggableTag(classTag), message);
   }

   public static void w(String classTag, String message, Throwable e) {
	 Log.w(createLoggableTag(classTag), message, e);
   }

   public static void w(String classTag, Throwable e) {
	 Log.w(createLoggableTag(classTag), e);
   }

   public static void w(String classTag, String message) {
	 Log.w(createLoggableTag(classTag), message);
   }

   public static void i(String classTag, String message, Throwable e) {
	 Log.i(createLoggableTag(classTag), message, e);
   }

   public static void i(String classTag, String message) {
	 Log.i(createLoggableTag(classTag), message);
   }

   public static void d(String classTag, String message, Throwable e) {
	 Log.d(createLoggableTag(classTag), message, e);
   }

   public static void d(String classTag, String message) {
	 Log.d(createLoggableTag(classTag), message);
   }

   private static String createLoggableTag(String classTag) {
	 return TAG + classTag;
   }

   /**
    * Returns the application tag - this can be used to filter logfiles when
    * appending an asterix to the application tag*s end.
    * 
    * @return the tag for the application
    */
   public static String getApplicationTag() {
	 return TAG;
   }
}
